<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /**
       * Definition for a binary tree node.
       * function TreeNode(val, left, right) {
       *     this.val = (val===undefined ? 0 : val)
       *     this.left = (left===undefined ? null : left)
       *     this.right = (right===undefined ? null : right)
       * }
       */
      /**
       * @param {TreeNode} root
       * @return {number[]}
       */
      var inorderTraversal = function (root) {
        let res = [];
        const search = (root) => {
          if (!root) {
            return;
          }
          search(root.left);
          res.push(root.val);
          search(root.right);
        };
        search(root);
        return res;
      };
    </script>
  </body>
</html>
